{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "# Relative cost of matrix factorizations"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import numpy as np\n",
        "import numpy.linalg as npla\n",
        "import scipy.linalg as spla\n",
        "\n",
        "import matplotlib.pyplot as pt\n",
        "\n",
        "from time import time"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 2,
      "metadata": {
        "collapsed": false
      },
      "outputs": [
        {
          "data": {
            "text/plain": [
              "array([  10,   14,   20,   30,   43,   63,   92,  133,  193,  279,  404,\n",
              "        585,  848, 1228, 1778], dtype=int32)"
            ]
          },
          "execution_count": 2,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "n_values = (10**np.linspace(1, 3.25, 15)).astype(np.int32)\n",
        "n_values"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 9,
      "metadata": {
        "collapsed": false
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "-----> lu\n",
            "10\n",
            "14\n",
            "20\n",
            "30\n",
            "43\n",
            "63\n",
            "92\n",
            "133\n",
            "193\n",
            "279\n",
            "404\n",
            "585\n",
            "848\n",
            "1228\n",
            "1778\n",
            "-----> qr\n",
            "10\n",
            "14\n",
            "20\n",
            "30\n",
            "43\n",
            "63\n",
            "92\n",
            "133\n",
            "193\n",
            "279\n",
            "404\n",
            "585\n",
            "848\n",
            "1228\n",
            "1778\n",
            "-----> svd\n",
            "10\n",
            "14\n",
            "20\n",
            "30\n",
            "43\n",
            "63\n",
            "92\n",
            "133\n",
            "193\n",
            "279\n",
            "404\n",
            "585\n",
            "848\n",
            "1228\n",
            "1778\n"
          ]
        },
        {
          "data": {
            "text/plain": [
              "<matplotlib.text.Text at 0x7f846db8ea90>"
            ]
          },
          "execution_count": 9,
          "metadata": {},
          "output_type": "execute_result"
        },
        {
          "data": {
            "image/png": "iVBORw0KGgoAAAANS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jVb0j9DXujVt6qGpo\nX8QLqnrL9j6Uqn4uIje6FUAHnIrImKixNkoTK54DRqnqdyHLOgCr3QpgT+BAd/l6oF3tN9iOJ4F/\nAeNxmnC24t4lbLOqvoJTEfWv9fxA4FrgrJDFHwNDRaS6wsoQkV3qeO9UYLM7ezwwRUSsw9lEjR0J\nmKBTAFX9DXg0ZJkC/wEuEZG5ODcomuq+dpWI/E9E5uB0Kj/GtmcTObeZEzkbKFXVV92O2y9EJFtV\nC0Ne2w+4X0SqgHLgktD3AC7HOSOpwG36ma6qF4nIv4AP3PctxzljaUmtHHuzpT9gA7Arzt3TjIkK\n6xg2xpg4Zs1BxhgTx6wSMMaYOGaVgDHGxDGrBIwxJo5ZJWCMMXHMKgFjjIljVgkYY0wcs0rAGGPi\n2P8HjaciA9mJ77QAAAAASUVORK5CYII=\n",
            "text/plain": [
              "<matplotlib.figure.Figure at 0x7f846dcafe48>"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        }
      ],
      "source": [
        "for name, f in [\n",
        "        (\"lu\", spla.lu_factor),\n",
        "        (\"qr\", npla.qr),\n",
        "        (\"svd\", npla.svd)\n",
        "        ]:\n",
        "\n",
        "    times = []\n",
        "    print(\"----->\", name)\n",
        "    \n",
        "    for n in n_values:\n",
        "        print(n)\n",
        "\n",
        "        A = np.random.randn(n, n)\n",
        "        \n",
        "        start_time = time()\n",
        "        f(A)\n",
        "        times.append(time() - start_time)\n",
        "        \n",
        "    pt.plot(n_values, times, label=name)\n",
        "\n",
        "pt.grid()\n",
        "pt.legend(loc=\"best\")\n",
        "pt.xlabel(\"Matrix size $n$\")\n",
        "pt.ylabel(\"Wall time [s]\")"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "* The faster algorithms make the slower ones look bad. But... it's all relative.\n",
        "* Is there a better way of plotting this?\n",
        "* Can we see the asymptotic cost ($O(n^3)$) of these algorithms from the plot?"
      ]
    }
  ],
  "metadata": {},
  "nbformat": 4,
  "nbformat_minor": 0
}